;@+leo-ver=5-thin
;@+node:caminhante.20211216002840.1: * @file xforth.fth
;@@language assembly_x86
;@@nocolor
;@@tabwidth -2
;@+others
;@+node:caminhante.20211216003106.1: ** Prelude
prelude
;@+others
;@+node:caminhante.20211214151505.1: *3* struc registers
struc registers {
  .eax rd 1
  .ebx rd 1
  .ecx rd 1
  .edx rd 1
  .esi rd 1
  .edi rd 1
}
;@+node:caminhante.20211214151537.1: *3* macro save_reg
macro save_reg [reg*] {
  mov [reg_buffer.#reg], reg
}
;@+node:caminhante.20211214151544.1: *3* macro restore_reg
macro restore_reg [reg*] {
  mov reg, [reg_buffer.#reg]
}
;@-others
endprelude
;@+node:caminhante.20211216003247.1: ** Words
;@+node:caminhante.20211214151610.1: *3* Stack management
;@+node:caminhante.20211214151640.1: *4* DROP
code DROP
  pop eax
endcode
;@+node:caminhante.20211214151646.1: *4* SWAP
code SWAP
  pop eax
  pop ebx
  push eax
  push ebx
endcode
;@+node:caminhante.20211214151650.1: *4* DUP1
code DUP1
  push dword [esp]
endcode
;@+node:caminhante.20211214151655.1: *4* OVER
code OVER
  push dword [esp+4]
endcode
;@+node:caminhante.20211214151659.1: *4* ROT
code ROT
  pop eax
  pop ebx
  pop ecx
  push ebx
  push eax
  push ecx
endcode
;@+node:caminhante.20211214151705.1: *4* UNROT
code UNROT
  pop eax
  pop ebx
  pop ecx
  push eax
  push ecx
  push ebx
endcode
;@+node:caminhante.20211214151709.1: *4* DROP2
code DROP2
  pop eax
  pop eax
endcode
;@+node:caminhante.20211214151714.1: *4* DUP2
code DUP2
  mov eax, [esp]
  mov ebx, [esp+4]
  push ebx
  push eax
endcode
;@+node:caminhante.20211214151720.1: *4* SWAP2
code SWAP2
  pop eax
  pop ebx
  pop ecx
  pop edx
  push ebx
  push eax
  push edx
  push ecx
endcode
;@+node:caminhante.20211214151726.1: *4* NZDUP
code NZDUP
  mov eax, [esp]
  test eax, eax
  jz @f
  push eax
  @@:
endcode
;@+node:caminhante.20211216004419.1: *3* Arithmetic tests
;@+node:caminhante.20211214153335.1: *4* ISEQU
code ISEQU
  pop eax
  cmp eax, [esp]
  sete al
  movzx eax, al
  mov [esp], eax
endcode
;@+node:caminhante.20211214153349.1: *4* ISDIF
code ISDIF
  pop eax
  cmp eax, [esp]
  setne al
  movzx eax, al
  mov [esp], eax
endcode
;@+node:caminhante.20211216003728.1: ** main
word main
endword
;@-others
;@-leo
